﻿using System;
using System.Collections.Generic;
using System.Web.UI;
using DMS.Business.Utility;
using DMS.BaseClass;


namespace DMS.BaseClass
{
    public class ContentFormControlBase : System.Web.UI.UserControl
    {
        protected ActionType _Action = ActionType.View;
        protected virtual List<Control> ControlSet
        {
            get
            {
                return new List<Control>();
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            this.SetControlState();
            base.OnPreRender(e);
        }

        private void SetControlState()
        {
            List<Control> ctrls = this.ControlSet;
            foreach (Control ctrl in ctrls)
            {
                // ReadOnly
                ClientHelper.Instance.SetReadOnlyStatue(ctrl, this._Action.ToString());
                // Visible
                ClientHelper.Instance.SetDisplayStatue(ctrl, this._Action.ToString());
            }
        }
    }
}
